/**
 * @Author: YU
 * @Date: 2021-09-11 15:40:46
 * @LastEditTime: 2021-10-24 23:39:47
 * @LastEditors: YU
 * @Description: Vuex
 */
import Vue from 'vue'
import Vuex from 'vuex'
import { getItem, setItem } from '@/utils/storage'

Vue.use(Vuex)

const USER_KEY = 'USER_KEY'
export default new Vuex.Store({
  state: {
    user: getItem(USER_KEY)
  },
  mutations: {
    setUser(state, user) {
      state.user = user
      setItem('USER_KEY', user)
    }
  },
  actions: {},
  modules: {}
})
